﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Objects.DataClasses;
using System.Runtime.Serialization;
using System.Xml.Serialization;
using System.ComponentModel;

namespace FinalProject.DAL.Model
{
    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName = "InvoiceModel", Name = "DeliveryDocument")]
    [Serializable()]
    [DataContractAttribute(IsReference = true)]
    public partial class DeliveryDocument : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new DeliveryDocument object.
        /// </summary>
        /// <param name="id">Initial value of the Id property.</param>
        /// <param name="docNumber">Initial value of the DocNumber property.</param>
        /// <param name="docDate">Initial value of the DocDate property.</param>
        /// <param name="totalAmount">Initial value of the TotalAmount property.</param>
        /// <param name="orderDocumentId">Initial value of the OrderDocumentId property.</param>
        /// <param name="CustomerId">Initial value of the CustomerId property.</param>
        public static DeliveryDocument CreateDeliveryDocument(global::System.Guid id, global::System.Int64 docNumber, global::System.DateTime docDate, global::System.Decimal totalAmount, global::System.Guid orderDocumentId, global::System.Guid CustomerId)
        {
            DeliveryDocument deliveryDocument = new DeliveryDocument();
            deliveryDocument.Id = id;
            deliveryDocument.DocNumber = docNumber;
            deliveryDocument.DocDate = docDate;
            deliveryDocument.TotalAmount = totalAmount;
            deliveryDocument.OrderDocumentId = orderDocumentId;
            deliveryDocument.CustomerId = CustomerId;
            return deliveryDocument;
        }

        #endregion

        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = true, IsNullable = false)]
        [DataMemberAttribute()]
        public global::System.Guid Id
        {
            get
            {
                return _Id;
            }
            set
            {
                if (_Id != value)
                {
                    OnIdChanging(value);
                    ReportPropertyChanging("Id");
                    _Id = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("Id");
                    OnIdChanged();
                }
            }
        }
        private global::System.Guid _Id;
        partial void OnIdChanging(global::System.Guid value);
        partial void OnIdChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
        [DataMemberAttribute()]
        public global::System.Int64? DocNumber
        {
            get
            {
                return _DocNumber;
            }
            set
            {
                OnDocNumberChanging(value);
                ReportPropertyChanging("DocNumber");
                _DocNumber = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("DocNumber");
                OnDocNumberChanged();
            }
        }
        private global::System.Int64? _DocNumber;
        partial void OnDocNumberChanging(global::System.Int64? value);
        partial void OnDocNumberChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
        [DataMemberAttribute()]
        public global::System.DateTime? DocDate
        {
            get
            {
                return _DocDate;
            }
            set
            {
                OnDocDateChanging(value);
                ReportPropertyChanging("DocDate");
                _DocDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("DocDate");
                OnDocDateChanged();
            }
        }
        private global::System.DateTime? _DocDate;
        partial void OnDocDateChanging(global::System.DateTime? value);
        partial void OnDocDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
        [DataMemberAttribute()]
        public global::System.String DocAddress
        {
            get
            {
                return _DocAddress;
            }
            set
            {
                OnDocAddressChanging(value);
                ReportPropertyChanging("DocAddress");
                _DocAddress = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("DocAddress");
                OnDocAddressChanged();
            }
        }
        private global::System.String _DocAddress;
        partial void OnDocAddressChanging(global::System.String value);
        partial void OnDocAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
        [DataMemberAttribute()]
        public global::System.Decimal? TotalAmount
        {
            get
            {
                return _TotalAmount;
            }
            set
            {
                OnTotalAmountChanging(value);
                ReportPropertyChanging("TotalAmount");
                _TotalAmount = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("TotalAmount");
                OnTotalAmountChanged();
            }
        }
        private global::System.Decimal? _TotalAmount;
        partial void OnTotalAmountChanging(global::System.Decimal? value);
        partial void OnTotalAmountChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
        [DataMemberAttribute()]
        public global::System.String Desciption
        {
            get
            {
                return _Desciption;
            }
            set
            {
                OnDesciptionChanging(value);
                ReportPropertyChanging("Desciption");
                _Desciption = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Desciption");
                OnDesciptionChanged();
            }
        }
        private global::System.String _Desciption;
        partial void OnDesciptionChanging(global::System.String value);
        partial void OnDesciptionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
        [DataMemberAttribute()]
        public global::System.Guid OrderDocumentId
        {
            get
            {
                return _OrderDocumentId;
            }
            set
            {
                OnOrderDocumentIdChanging(value);
                ReportPropertyChanging("OrderDocumentId");
                _OrderDocumentId = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("OrderDocumentId");
                OnOrderDocumentIdChanged();
            }
        }
        private global::System.Guid _OrderDocumentId;
        partial void OnOrderDocumentIdChanging(global::System.Guid value);
        partial void OnOrderDocumentIdChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
        [DataMemberAttribute()]
        public global::System.Guid CustomerId
        {
            get
            {
                return _CustomerId;
            }
            set
            {
                OnCustomerIdChanging(value);
                ReportPropertyChanging("CustomerId");
                _CustomerId = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("CustomerId");
                OnCustomerIdChanged();
            }
        }
        private global::System.Guid _CustomerId;
        partial void OnCustomerIdChanging(global::System.Guid value);
        partial void OnCustomerIdChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("InvoiceModel", "OrderDocumentDeliveryDocument", "OrderDocument")]
        public OrderDocument OrderDocument
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<OrderDocument>("InvoiceModel.OrderDocumentDeliveryDocument", "OrderDocument").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<OrderDocument>("InvoiceModel.OrderDocumentDeliveryDocument", "OrderDocument").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<OrderDocument> OrderDocumentReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<OrderDocument>("InvoiceModel.OrderDocumentDeliveryDocument", "OrderDocument");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<OrderDocument>("InvoiceModel.OrderDocumentDeliveryDocument", "OrderDocument", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("InvoiceModel", "DeliveryDocumentInvoiceDocument", "InvoiceDocument")]
        public EntityCollection<InvoiceDocument> InvoiceDocuments
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<InvoiceDocument>("InvoiceModel.DeliveryDocumentInvoiceDocument", "InvoiceDocument");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<InvoiceDocument>("InvoiceModel.DeliveryDocumentInvoiceDocument", "InvoiceDocument", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("InvoiceModel", "DeliveryDocumentDocumentRow", "DocumentRow")]
        public EntityCollection<DocumentRow> DocumentRows
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<DocumentRow>("InvoiceModel.DeliveryDocumentDocumentRow", "DocumentRow");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<DocumentRow>("InvoiceModel.DeliveryDocumentDocumentRow", "DocumentRow", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("InvoiceModel", "CustomerDeliveryDocument", "Customer")]
        public Customer Customer
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customer>("InvoiceModel.CustomerDeliveryDocument", "Customer").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customer>("InvoiceModel.CustomerDeliveryDocument", "Customer").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Customer> CustomerReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customer>("InvoiceModel.CustomerDeliveryDocument", "Customer");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Customer>("InvoiceModel.CustomerDeliveryDocument", "Customer", value);
                }
            }
        }

        #endregion
    }
}
